package com.giveu.signature.common.constants;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public enum FileSuffix {

	HTML(Arrays.asList(".html",".htm")),
	
	PDF(Arrays.asList(".pdf")),
	
	DOC(Arrays.asList(".doc",".docx")),
	;
	
	List<String> suffixList;

	private FileSuffix(List<String> suffixList) {
		this.suffixList = suffixList;
	}

	public List<String> getSuffixList() {
		return suffixList;
	}

	public void setSuffixList(List<String> suffixList) {
		this.suffixList = suffixList;
	}
	
	
	public static List<String> getAllSuffixList() {
		List<String> aList = new ArrayList<String>();
		for (FileSuffix suffix : FileSuffix.values()) {
			aList.addAll(suffix.suffixList);
		}
		return aList;
	}
	
	public static boolean checkSuffix(String suf) {
		for (FileSuffix suffix : FileSuffix.values()) {
			if(suffix.suffixList.contains(suf)){
				return true;
			}
		}
		return false;
	}
	
	public static FileSuffix getFileSuffix(String suf) {
		for (FileSuffix suffix : FileSuffix.values()) {
			if(suffix.suffixList.contains(suf)){
				return suffix;
			}
		}
		return null;
	}
	
}
